package cn.edu.sdju.fengguoyu.ahoedgemonitor;

import cn.edu.sdju.fengguoyu.po.ServiceInfoTableRow;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;

import java.net.URL;
import java.util.ResourceBundle;

public class ServiceTable implements Initializable {
    @FXML
    public TableView<ServiceInfoTableRow> table;
    @FXML
    public TableColumn<ServiceInfoTableRow, String> named;
    @FXML
    public TableColumn<ServiceInfoTableRow, String> serviceAddress;
    @FXML
    public TableColumn<ServiceInfoTableRow, String> serviceStatus;
    @FXML
    public TableColumn<ServiceInfoTableRow, Integer> serviceId;
    @FXML
    public TableColumn<ServiceInfoTableRow, Integer> rank;
    @FXML
    public TableColumn<ServiceInfoTableRow, String> type;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        serviceId.setCellValueFactory(new PropertyValueFactory<>("id"));
        type.setCellValueFactory(new PropertyValueFactory<>("type"));

        rank.setCellValueFactory(new PropertyValueFactory<>("rank"));
        named.setCellValueFactory(new PropertyValueFactory<>("named"));
        serviceAddress.setCellValueFactory(new PropertyValueFactory<>("serviceAddress"));
        serviceStatus.setCellValueFactory(new PropertyValueFactory<>("serviceStatus"));
        table.setItems(App.getApp().serviceInfoTableRowObservableList);
    }
}
